Skip Headers

Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
Home | Book List | Contents | Index | Master Index | Feedback

# GetDatabase Method

Applies To

OBinder

ODynaset

OSqlStmt

ODatabaseCollection

Description

This method returns the associated database object by way of an ODatabase handle.

Usage

ODatabase GetDatabase(void) const

Remarks

Given an Odynaset, Obinder, or an OSqlStmt object, you can obtain an ODatabase object, which you can then use to access the Odynaset's, Obinder's, or OSqlStmt's database. Note that this does not create another database object; rather, it returns another ODatabase that is a handle for an already existing database object.

Return Value

An ODatabase, which will be open on success, closed on failure.

Example

This example assumes that we have been working with an ODynaset object and now we want to execute a general SQL statement on the database.

// we've got an open ODynaset named workdyn

// get an ODatabase from workdyn

ODatabase workdb = workdyn.GetDatabase();

// now execute an SQL statement

workdb.ExecuteSQL("drop table tempwork");

// to do just one thing, we don't even need an ODatabase instance

// so we could have said

workdyn.GetDatabase().ExecuteSQL("drop table tempwork");